import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import store from './store'
// import NProgress from 'nprogress'
// import 'nprogress/nprogress.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios';
// import Vuex from "vuex";
// NProgress.configure({ showSpinner: false })
import { getToken } from '@/util/auth'
// import './router/permission'
// const whiteList = ['/login', '/register']

Vue.use(ElementUI)
// Vue.use(Vuex)
Vue.config.productionTip = false

// 添加拦截器
axios.interceptors.request.use(
  config => {
    // 是否需要设置 token
    const isToken = (config.headers || {}).isToken === false
    if (getToken() && !isToken) {
      config.headers.Authorization = getToken()
    }
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
